package news_create_config

import (
	createConfigDto "news_for_deepseek_interface/dto/admin/news/create_config"
	"news_for_deepseek_interface/model"
	"news_for_deepseek_interface/model/news"
	"time"
)

func Create(params createConfigDto.CreateRequest) error {
	db := model.GetInstance().GetDB()

	return db.Create(&news.NewsCreateConfig{
		Title:                        params.Title,
		BasisCreateType:              params.BasisCreateType,
		BasisKeywords:                params.BasisKeywords,
		BasisTitle:                   params.BasisTitle,
		BasisDescription:             params.BasisDescription,
		BasisContainKeywords:         params.BasisContainKeywords,
		CreateType:                   params.CreateType,
		CreateTypeProductName:        params.CreateTypeProductName,
		CreateTypeProductDescription: params.CreateTypeProductDescription,
		CreateTypeProductRank:        params.CreateTypeProductRank,
		CreateTypeCompetitor:         params.CreateTypeCompetitor,
		CreateTypeRatioTop:           params.CreateTypeRatioTop,
		CreateTypeRatioWhat:          params.CreateTypeRatioWhat,
		CreateTypeRatioHow:           params.CreateTypeRatioHow,
		ReplaceContent:               params.ReplaceContent,
		ContentFormat:                params.ContentFormat,
		ArticleStructure:             params.ArticleStructure,
		ArticleStructureSize:         params.ArticleStructureSize,
		ArticleStructureTitle:        params.ArticleStructureTitle,
		CreatedAt:                    time.Now(),
		UpdatedAt:                    time.Now(),
	}).Error
}
